﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class JPODetails
    {
        public int jPODetailsID;// [jPODetailsID] [int] NOT NULL,
        public string PoNo;       //[PoNo] [varchar](20) NOT NULL,
        public int PoLineItemNo;     //[PoLineItemNo] [int] NOT NULL,
        public string ItemCode;   //[ItemCode] [varchar](25) NOT NULL,
        public string ItemDetail;      //[ItemDetail] [varchar](255) NULL,
        public string UOM;    //[UOM] [varchar](3) NULL,
        public string Packing;      //[Packing] [varchar](25) NULL,
        public decimal OrdQty;    //[OrdQty] [float] NULL,
        public decimal UnitPrice;     //[UnitPrice] [float] NULL,
        public DateTime ReadinessDate;    //[ReadinessDate] [datetime] NULL,
        public string AccountCode;      //[AccountCode] [varchar](80) NULL,
        public string ItemRemarks;      //[ItemRemarks] [varchar](60) NULL,
        public DateTime AddedOn;    //[AddedOn] [datetime] NULL,

        public JPODetails(SqlDataReader rd)
        {
            jPODetailsID = rd["jPODetailsID"] is DBNull ? jPODetailsID : Convert.ToInt32(rd["jPODetailsID"]);
            PoNo = rd["PoNo"] is DBNull ? PoNo : rd["PoNo"].ToString();
            PoLineItemNo = rd["PoLineItemNo"] is DBNull ? PoLineItemNo : Convert.ToInt32(rd["PoLineItemNo"]);
            ItemCode = rd["ItemCode"] is DBNull ? ItemCode : rd["ItemCode"].ToString();
            ItemDetail = rd["ItemDetail"] is DBNull ? ItemDetail : rd["ItemDetail"].ToString();
            UOM = rd["UOM"] is DBNull ? UOM : rd["UOM"].ToString();
            Packing = rd["Packing"] is DBNull ? Packing : rd["Packing"].ToString();
            OrdQty = rd["OrdQty"] is DBNull ? OrdQty : Convert.ToDecimal(rd["OrdQty"]);
            UnitPrice = rd["UnitPrice"] is DBNull ? UnitPrice : Convert.ToDecimal(rd["UnitPrice"]);
            ReadinessDate = rd["ReadinessDate"] is DBNull ? ReadinessDate : Convert.ToDateTime(rd["ReadinessDate"]);
            AccountCode = rd["AccountCode"] is DBNull ? AccountCode : rd["AccountCode"].ToString();
            ItemRemarks = rd["AccountCode"] is DBNull ? AccountCode : rd["AccountCode"].ToString();
            AddedOn = rd["AddedOn"] is DBNull ? AddedOn : Convert.ToDateTime(rd["AddedOn"]);
        }
    }
}
